package com.dgut.smart_house.mapper;

import com.dgut.smart_house.domain.Node;
import com.dgut.smart_house.domain.Types;
import com.dgut.smart_house.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface AdminMapper {

    @Insert("insert into node(node_name,node_desc)values(#{nodeName},#{desc})")
    public int addNewNode(Node node);

    @Insert("insert into types(type_desc,max_num,unit,from_node)values(#{typedesc},#{maxNum},#{unit},#{fromNode})")
    public int addNewType(Types types);

    @Select("select user_id,email,perms from user")
    public List<User> selectAllUsers();

    @Delete("delete from user where id=userId")
    public int deleteOneUser(int Id);
}
